package com.yxt.qmgf;


import com.yxt.qmgf.common.ImageSrc;

import com.yxt.qmgf.start.view.MainStageView;
import com.yxt.qmgf.start.view.WelcomeScreen;
import com.yxt.qmgf.start.view.WelcomeView;
import de.felixroske.jfxsupport.AbstractJavaFxApplicationSupport;

import javafx.scene.image.Image;
import javafx.stage.Stage;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.Collection;
import java.util.LinkedList;

@MapperScan("com.yxt.qmgf.**.dao")
@SpringBootApplication
public class ApplicationStarter extends AbstractJavaFxApplicationSupport {
    public static void main(String[] args) {
            launch(ApplicationStarter.class, WelcomeView.class, new WelcomeScreen(), args);
    }

    @Override
    public void start(Stage stage) throws Exception {
        stage.setTitle("趣梦工坊");
        stage.setResizable(false);
        super.start(stage);
    }

    @Override
    public Collection<Image> loadDefaultIcons() {
        LinkedList<Image> images = new LinkedList<>();
        images.add(new Image(ImageSrc.lOGO_PATH));
        return images;
    }

    public static void toMainStageView() {
        Stage stage = getStage();
        stage.close();
        stage.setMaximized(false);
        stage.setMinWidth(345);
        stage.setMinHeight(300);
        stage.setResizable(true);
        showView(MainStageView.class);
    }
}
